{include file='common/head.html'}

<div class="layui-body">
	{if([$list])}
	<div class="layui-tab layui-tab-brief" lay-filter="tab">
	  <ul class="layui-tab-title">
	    <li class="layui-this" lay-id="t1">标签管理</li>
	    <li lay-id="t2">添加标签</li>
	  </ul>
	  <div class="layui-tab-content">
		  <div class="layui-tab-item layui-show">
			  <form action="{url./admin/Tags/index}" method="get" class="layui-form">
				  {$pathinfo}
				  <div class="layui-form-item nospace">
					  <div class="layui-input-inline">
						  <input type="text" name="tag"  value="{$get.tag}"  placeholder="请输入标签" class="layui-input">
					  </div>
					  <div class="layui-input-inline">
						  <input type="text" name="title"  value="{$get.title}"  placeholder="请输入Title" class="layui-input">
					  </div>
					  <div class="layui-input-inline">
						  <select name="is_hot">
							  <option value="">请选择是否热门</option>
							  {$is_hot_select}
						  </select>
					  </div>


					  <div class="layui-input-inline">
						  <button class="layui-btn" lay-submit>搜索</button>
						  <a class="layui-btn layui-btn-primary"  href="{url./admin/Slide/index}">清除搜索</a>
					  </div>
				  </div>
			  </form>

			  <form action="{url./admin/Tags/mod}" method="post" class="layui-form" id="contentForm" name="contentForm"  onkeydown="if(event.keyCode==13) return false;">
				  <input type="hidden" name="formcheck" value="{$formcheck}" >
				  <table class="layui-table">
					  <thead>
					  <tr>
						  <th><input type="checkbox" class="checkbox" lay-ignore id="checkall" title="全选"></th>
						  <th>ID</th>
						  <th width="100">标签</th>
						  <th>Title</th>
						  <th>Description</th>
						  <th>Keywords</th>
						  <th>链接名</th>
						  <th width="80">是否热门</th>
						  <th>相关标签</th>
						  <th width="80">操作</th>
					  </tr>
					  </thead>
					  <tbody>
					  {foreach $tags(key,value)}
					  <tr>
						  <td>
							  <input type="checkbox" class="checkbox checkitem" lay-ignore name="list[]" value="[value->id]">
							  <input type="hidden" name="listall[]" value="[value->id]">
						  </td>
						  <td>[value->id]</td>
						  <td>[value->tag]</td>
						  <td>[value->title]</td>
						  <td>[value->description]</td>
						  <td>[value->keywords]</td>
						  <td>[value->link_name]</td>
						  <td>
							  {if($value->is_hot)}
							  <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/is_hot/value/0}" class="switch"><i class='fa fa-toggle-on' title="点击关闭"></i></a>
							  {else}
							  <a href="{url./admin/'.C.'/mod/id/'.$value->id.'/field/is_hot/value/1}" class="switch"><i class='fa fa-toggle-off' title="点击开启"></i></a>
							  {/if}
						  </td>
						  <td>[value->related_tag]</td>
						  <td>
							  {fun=get_btn_del($value->id)}
							  {fun=get_btn_mod($value->id)}
						  </td>
					  </tr>
					  {/foreach}
					  </tbody>
				  </table>
				  <div class="layui-btn-group">
					  {if(check_level('del'))}
					  <button type="submit" name="submit" onclick="return setDelAction();" class="layui-btn layui-btn-sm">批量删除</button>
					  {/if}
					  {if(check_level('mod'))}
					  <button type="submit" name="submit" value="sorting" class="layui-btn layui-btn-sm">保存排序</button>
					  {/if}
				  </div>
				  <script>
                      function setDelAction(){
                          document.contentForm.action = "{url./admin/Content/del}";
                          return confirm("您确定要删除选中的内容么？");
                      }
				  </script>
			  </form>
			<div class="page">{$pagebar}</div>
	  	</div>
	  	<div class="layui-tab-item">
	  		 <form action="{url./admin/Tags/add}" method="post" class="layui-form">
	  		 	<input type="hidden" name="formcheck" value="{$formcheck}" > 

                 <div class="layui-form-item">
					 <label class="layui-form-label"><span style="color:red;">*</span>标签</label>
                     <div class="layui-input-block">
                     	<input type="text" name="tag" required  lay-verify="required" placeholder="请输入标签"  class="layui-input">
                     </div>
                </div>

				 <div class="layui-form-item">
					 <label class="layui-form-label">Title</label>
					 <div class="layui-input-block">
						 <input type="text" name="title" placeholder="请输入Title"  class="layui-input">
					 </div>
				 </div>
				 <div class="layui-form-item">
					 <label class="layui-form-label">Description</label>
					 <div class="layui-input-block">
						 <input type="text" name="description" placeholder="请输入Description"  class="layui-input">
					 </div>
				 </div>
				 <div class="layui-form-item">
					 <label class="layui-form-label">Keywords</label>
					 <div class="layui-input-block">
						 <input type="text" name="keywords" placeholder="请输入Keywords"  class="layui-input">
					 </div>
				 </div>
				 <div class="layui-form-item">
					 <label class="layui-form-label">链接名</label>
					 <div class="layui-input-block">
						 <input type="text" name="link_name" placeholder="请输入链接名"  class="layui-input">
					 </div>
				 </div>
				 <div class="layui-form-item">
					 <label class="layui-form-label">是否热门</label>
					 <div class="layui-input-block">
						 <div class="layui-input-inline">
							 <select name="is_hot">
								 {$is_hot_select}
							 </select>
						 </div>
					 </div>
				 </div>

				 <div class="layui-form-item">
					 <label class="layui-form-label">相关标签</label>
					 <div class="layui-input-block">
						 <input type="text" name="related_tag" placeholder="请输入相关标签"  class="layui-input">
					 </div>
				 </div>
				 <div class="layui-form-item">
					 <label class="layui-form-label">排序</label>
					 <div class="layui-input-block">
						 <input type="text" name="sorting" required lay-verify="required" value="255" placeholder="请输入排序"  class="layui-input">
					 </div>
				 </div>

				 <div class="layui-form-item">
					 <label class="layui-form-label">内容</label>
					 <div class="layui-input-block">
						 <textarea name="content" placeholder="请输入内容" class="layui-textarea"></textarea>
					 </div>
				 </div>

                <div class="layui-form-item">
					 <div class="layui-input-block">
					    <button class="layui-btn" lay-submit>立即提交</button>
					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
					 </div>
				</div>
	  		 </form>
	  	</div>
	  </div>
	</div>
	{/if} 
	
	{if([$mod])}
	<div class="layui-tab layui-tab-brief" lay-filter="tab">
	  <ul class="layui-tab-title">
	    <li class="layui-this">标签修改</li>
	  </ul>
	  <div class="layui-tab-content">
	  	<div class="layui-tab-item layui-show">
	  		 <form action="{url./admin/Tags/mod/id/'.[$get.id].'}{$backurl}" method="post" class="layui-form">
	  		 	<input type="hidden" name="formcheck" value="{$formcheck}" >

				 <div class="layui-form-item">
					 <label class="layui-form-label"><span style="color:red;">*</span>标签</label>
					 <div class="layui-input-block">
						 <input type="text" name="tag" required  lay-verify="required" value="{$tags->tag}" placeholder="请输入标签"  class="layui-input">
					 </div>
				 </div>

				 <div class="layui-form-item">
					 <label class="layui-form-label">Title</label>
					 <div class="layui-input-block">
						 <input type="text" name="title" placeholder="请输入Title" value="{$tags->title}"  class="layui-input">
					 </div>
				 </div>
				 <div class="layui-form-item">
					 <label class="layui-form-label">Description</label>
					 <div class="layui-input-block">
						 <input type="text" name="description" placeholder="请输入Description" value="{$tags->description}" class="layui-input">
					 </div>
				 </div>
				 <div class="layui-form-item">
					 <label class="layui-form-label">Keywords</label>
					 <div class="layui-input-block">
						 <input type="text" name="keywords" placeholder="请输入Keywords" value="{$tags->keywords}"  class="layui-input">
					 </div>
				 </div>
				 <div class="layui-form-item">
					 <label class="layui-form-label">链接名</label>
					 <div class="layui-input-block">
						 <input type="text" name="link_name" placeholder="请输入链接名" value="{$tags->link_name}"  class="layui-input">
					 </div>
				 </div>
				 <div class="layui-form-item">
					 <label class="layui-form-label">是否热门</label>
					 <div class="layui-input-block">
						 <div class="layui-input-inline">
							 <select name="is_hot">
								 {$is_hot_select}
							 </select>
						 </div>
					 </div>
				 </div>

				 <div class="layui-form-item">
					 <label class="layui-form-label">相关标签</label>
					 <div class="layui-input-block">
						 <input type="text" name="related_tag" placeholder="请输入相关标签" value="{$tags->related_tag}"  class="layui-input">
					 </div>
				 </div>
				 <div class="layui-form-item">
					 <label class="layui-form-label">排序</label>
					 <div class="layui-input-block">
						 <input type="text" name="sorting" required lay-verify="required" value="{$tags->sorting}" placeholder="请输入排序"  class="layui-input">
					 </div>
				 </div>

				 <div class="layui-form-item">
					 <label class="layui-form-label">内容</label>
					 <div class="layui-input-block">
						 <textarea name="content" placeholder="请输入内容" class="layui-textarea">{$tags->content}</textarea>
					 </div>
				 </div>
                
                 <div class="layui-form-item">
					 <div class="layui-input-block">
					    <button class="layui-btn" lay-submit>立即提交</button>
					    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
					    {fun=get_btn_back()}
					 </div>
				</div>
				
	  		 </form>
	  	</div>
	  </div>
	 </div>
	{/if} 
</div>
{include file='common/foot.html'}
